<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    //Object.defineProperty常用于在对象上新增或修改一个新属性，并返回这个对象
    const obj = {}
    Object.defineProperty(obj,'name',{
        value:'kobe',
        writable:true,
        enumerable:true,
        configurable:true
    })
    let value = '18'
    Object.defineProperty(obj,'age',{
        get:function proxyGetter(){
            return value
        },
        set:function proxySetter(val){
            value = val
        }
    })
    console.log(obj)
    obj.age = 10
    console.log(obj)
</script>
</body>
</html>